%{
	business.BackstageSet  currBackstageSet = business.BackstageSet.getCurrentBackstageSet();
	boolean debtUse = constants.Constants.DEBT_USE;
}%
#{extends 'common/frontMain.html' /}
#{set title:currBackstageSet.seoTitle + ' | 我的账户   | 理财子账户  | 收款中的理财标'/}
<script type="text/javascript">
    $(function(){
		$("#xf_membill_shurk_yhm").focus(function(){
			  $(this).addClass("focus");
			  if($(this).val() ==this.defaultValue){  
                  $(this).val("");           
			  } 
		}).blur(function(){
			 $(this).removeClass("focus");
			 if ($(this).val() == '') {
                $(this).val(this.defaultValue);
             }
		});
		$(".membill_list_limit").limit();
		$("#xf_mem_hmdwindow").center();
		$("#xf_mem_hmd").click(function(){
			$("#xf_mem_hmdwindow").show();	
		});
	})
	$(function(){
			/* 高亮显示 */
			showHighLightFront(18);
			showHighLightFront2(7, 4);
		
			$("#xf_membill_shurk_yhm").focus(function(){
				  $(this).addClass("focus");
				  if($(this).val() ==this.defaultValue){  
	                  $(this).val("");           
				  } 
			}).blur(function(){
				 $(this).removeClass("focus");
				 if ($(this).val() == '') {
	                $(this).val(this.defaultValue);
	             }
			});
			$(".membill_list_limit").limit();
		})
</script>
<!-- 内容区域 start -->
	<div class="xf_con_box">
		<div class="xf_con_mem_nav"></div>
		<!-- 左边导航区域 -->
		#{include "front/account/AccountHome/homeLeft.control"/}
		<!-- 右侧内容区域 -->
		<div class="xf_mem_Account xf_mem_shzdjkb_box" id="bids">
		 #{form @repayingInvestBid(),method:'GET',id :'repayingInvestBid'}
		 <input type="hidden" id="currPage" name="currPage" />
            <input type="hidden" id="pageSize" name="pageSize" />
					<h3 class="xf_mem_accout_title">收款中的理财标</h3>
					<!-- 搜索区域 -->
					<ul class="xf_membill_search clr">
						<li>
							<select name="type" class="xf_membill_selectAge" id="type">   
						       <option value="0"
						        #{if page?.conditions?.type == 0}
				                  selected="selected"
				                  #{/if}>全部</option>   
						       <option value="1"
						        #{if page?.conditions?.type == 1}
				                  selected="selected"
				                  #{/if}>标题</option>   
						       <option value="2"
						        #{if page?.conditions?.type == 2}
				                  selected="selected"
				                  #{/if}>编号</option>   
							</select>
						</li>
						<li class="xf_membill_searchLi">
							<input type="text"   class="xf_membill_shurk_yhm" id="paramter" value="${page?.conditions?.keyWords}" name="keyWords"> 
							<input type="button" value="搜 索" class="xf_membill_button_yhm" onclick="repayingInvestBid();">
						</li>
					</ul>
					#{/form}
					<!-- 搜索结果 -->
					<div class="xf_membill_search_jg xf_membill_search_table">
						<div class="xf_membill_search_jgleft">
							<ul>
								<li class="xf_membill_search_th">序号</li>
								
								#{list items:page.page, as:'invest'}
								
								<li class="xf_membill_search_td">${invest_index}</li>
								
								#{/list}
								
								<li class="xf_membill_search_td xf_membill_search_tdlast">&nbsp;</li>
							</ul>
						</div>
						<div class="xf_membill_search_jgcenter">
							<table border="0" cellpadding="0" cellspacing="0" width="900" class="xf_membill_acc_viewcpms">
								<tbody>
									<tr>
									  	<th width="74" height="45">借款标编号</th>
									  	<th width="108">借款标标题</th>
									  	<th width="74">借款人</th>
									  	<th width="74">借款金额</th>
									  	<th width="74">年利率</th>
									  	<th width="74">本息合计应收</th>
									  	<th width="74">已收金额</th>
									  	<th width="74">剩余应收</th>
									  	<th width="74">账单情况</th>
									  	<th width="108">逾期未还账单</th>
									  	<th width="74">状态</th>
									  	<th width="100">协议书</th>
									</tr>
							  #{list items:page.page, as:'invest'}
									<tr>
										<td align="center">${invest?.no}</td>
										<td align="left"><span class="membill_list_limit" limit="24">${invest?.title}</span></td>
										<td align="center">${invest?.name?.asterisk()}</td>
										<td align="center">￥${invest?.bid_amount?.format('###,##0.00')}</td>
										<td align="center">${invest?.apr}%</td>
										<td align="center">
										#{if invest?.receiving_amount != null}
										${invest?.receiving_amount?.format('###,##0.00')}
										#{/if}
										#{else}
										0
										#{/else}
										</td>
										<td align="center">
										#{if invest?.has_received_amount != null}
										${invest?.has_received_amount?.format('###,##0.00')}
										#{/if}
										#{else}
										0
										#{/else}
										</td>
										<td align="center" >
										#{if invest?.receiving_amount != null}
										#{if invest?.has_received_amount != null}
										${(invest?.receiving_amount - invest?.has_received_amount)?.format('###,##0.00')}
										#{/if}
										
										#{else}
										${invest?.receiving_amount?.format('###,##0.00')}
										#{/else}
										#{/if}
										#{else}0#{/else}
										</td>
										<td align="center" width="37">
										#{if invest?.period_unit == 1 || invest?.is_sec_bid == true}
										${invest?.has_payback_period}/1
										#{/if}
										#{else}
										${invest?.has_payback_period}/${invest?.period}
										#{/else}
										</td>
										<td align="center">${invest?.overdue_payback_period}</td>
										<td align="center">
										#{if invest?.transfer_status ==0}
										正常
										#{/if}
										#{if invest?.transfer_status ==-1}
										已转让出
										#{/if}
										#{if invest?.transfer_status ==1}
										转让中
										#{/if}
										</td>
										<td align="center">
											<a class="xf_membill_cza" onclick="showProtocolist('${invest?.sign}');">查看合同</a>
											
										
										</td>
									</tr>
									#{/list}
									<tr>
										<td align="center"><span class="membill_list_lv2">合计</span></td>
										<td align="left"></td>
										<td align="center"></td>
										<td align="center"><span class="membill_list_lv3" id="bidAmount">￥0.00</span></td>
										<td align="center"></td>
										<td align="center"><span class="membill_list_lv3" id="receivingAmount">￥0.00</span></td>
										<td align="center"><span class="membill_list_lv3" id="hasReceivedAmount">￥0.00</span></td>
										<td align="center"><span class="membill_list_lv3" id="remainAmount">￥0.00</span></td>
										<td align="center"></td>
										<td align="center"></td>
										<td align="center"></td>
										<td align="center"></td>
									</tr>
								</tbody>
							</table>
						</div>
						
					
						<div class="xf_membill_search_jgright">
							<ul>
								<li class="xf_membill_search_th">操作项</li>
								#{list items:page.page, as:'invest'}
								<li class="xf_membill_search_td">
									<a href="@{front.invest.investAction.invest(invest?.bid_id)}" class="xf_membill_cza" target="_blank">标的详情</a>
									<span class="xf_memshzdjkb_czspan">|</span>
									<a href="@{front.account.InvestAccount.toInvestBill(invest?.sign)}" class="xf_membill_cza" target="_blank">理财账单</a><br/>
									#{if debtUse}
									#{if invest?.transfer_status == 0 && (constants.Constants.IS_DEBT_TWO || invest?.transfers_id == 0)}
									<a href="@{debtTransfer(invest?.sign)}" class="xf_membill_cza" target="_blank">债权转让</a>
									<span class="xf_memshzdjkb_czspan">|</span>   
									#{/if}
									#{/if}
									<a  class="xf_membill_cza" onclick="showName('${invest?.name?.asterisk()}','${invest?.bid_id}');">黑名单</a>
									<input type="hidden" value="${invest?.name}" id="black${invest_index}" />
					            #{/list}
								
								</li>
							</ul>
						</div>
					
						<!-- 清除浮动 -->
						<div class="clear"></div>
					</div>
					<!-- 分页器 -->
					<div class="xf_wylc_page xf_membill_view_page1">
					#{page currPage:page.currPage,pageSize:page.pageSize,totalCount:page.totalCount,theme:2,style:2 /}
					</div>
		
		</div>
		<!-- 清除浮动 -->
		<div class="clear"></div>
	</div>
	    <!-- 查看合同 -->
	<div class="xf_zqzr_znx_window" id="xf_mem_protocolistwindow">
		#{include "front/account/InvestAccount/repayingInvestBidProtocollist.control"/}
	</div>
	<!-- 黑名单 -->
	<div class="xf_zqzr_znx_window" id="xf_mem_hmdwindow">
	  #{include "front/account/InvestAccount/repayingInvestBidBlacklist.control"/}	
	</div>
<!-- 内容区域 end -->
<script>
     #{if code != 0}
       alert('${msg}');
     #{/if}
</script>
     <script >
     	function showName(userName,bidId){
     		$("#zqzrusername").html(userName);
     		$("#bidId").val(bidId);
     		$("#xf_mem_hmdwindow").show();
     	}
     	
     	function showProtocolist(sign){
    		$("#investSign").val(sign);
    		$("#type").val(1);
     		$("#xf_mem_protocolistwindow").show();
     	}
    	//合计
		var bidAmount = 0;//借款金额
		var investAmount = 0;//投标金额
		var receivingAmount = 0;
		var hasReceivedAmount = 0;
		var remainAmount = 0;
		#{list items:page.page, as:'invest'}
		 bidAmount += ${invest?.bid_amount};
		 receivingAmount += ${invest?.receiving_amount};
		 hasReceivedAmount += ${invest?.has_received_amount};
		 remainAmount = receivingAmount - hasReceivedAmount;
		#{/list}
		
		$("#bidAmount").html('￥'+bidAmount.toFixed(2));
		$("#receivingAmount").html('￥'+receivingAmount.toFixed(2));
		$("#hasReceivedAmount").html('￥'+hasReceivedAmount.toFixed(2));
		$("#remainAmount").html('￥'+remainAmount.toFixed(2));
     </script>
     <script>
     function showPage(currPage, pageSize){
         $("#currPage").val(currPage);
         $("#pageSize").val(pageSize);
         $("#repayingInvestBid").submit();
     }
     function repayingInvestBid(){
    	 $("#repayingInvestBid").submit();
        }
     
</script>
<script type="text/javascript" src="@{'/public/javascripts/tab/tab_usr.js'}"></script>